<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 编写一个方法去掉一个数组的重复元素['c', 'a', 'z', 'a', 'x', 'a']
        // ['c', 'a', 'z', 'a', 'x', 'a']  -> ['c', 'a', 'z', 'x']

        var arr = ['c', 'a', 'z', 'a', 'x', 'a'];
        var newArr = [];
        for(i=0;i<=arr.length-1;i++){
            if(newArr.indexOf(arr[i]) == -1){
                newArr.push(arr[i]);
            }
        }
        console.log(newArr);



    </script>



</body>

</html>